class_name EntityStateAnim_AdditionalEffect_AddBuff
extends EntityStateAnim_AdditionalEffect

#region 属性
@export var target_type:GameEnum.TargetDetectorTargetType
@export var radius:float = 0
@export var max_count:int = 0
@export var buff_ids:Array[String]
#endregion
#region 字段
#endregion
#region 信号
#endregion

#region 基类方法
func init_additional_effect(entity_state:EntityState):
	super.init_additional_effect(entity_state)
func excute():
	super.excute()
	var reses:Array[Util.AddCallMethodTrackRes] = []
	var camp_component = entity.get_component_by_name("CampComponent") as CampComponent
	var camp_types
	match target_type:
		GameEnum.TargetDetectorTargetType.Target:
			camp_types = camp_component.target_camps
		GameEnum.TargetDetectorTargetType.VisibleTarget:
			camp_types = camp_component.target_camps
		GameEnum.TargetDetectorTargetType.SameCampTarget:
			camp_types = camp_component.camp_camps
	var entities = GameCampSystem.get_target(camp_types,entity.global_position,true,max_count,radius)
	for ent in entities:
		var buff_component = ent.get_component_by_name("BuffComponent")
		if buff_component:
			for buff_id in buff_ids:
				buff_component.add_buff_by_id(buff_id)
	return reses
#endregion
#region 公共方法
#endregion
#region 私有方法
#endregion
#region 生命周期函数
#endregion
